<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:p="http://primefaces.prime.com.tr/ui"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets">

    <h:head>
        <title>Add Branch Information</title>
    </h:head>

    <h:body>
        <h:form id="formBranch" prependId="false">
            <p:panel id="panel" header="Add Branch Information">
                <p:messages />

                <p:tabView>  

                    <p:tab title="Branch and Contact Information">
                        <h:panelGrid columns="3" cellpadding="10">
                            <h:outputLabel for="branchName" style="font-weight: bold" value="Branch Name: * " />
                            <h:inputText autocomplete="off" required="true" label="Branch Name" requiredMessage="Branch Name is required." id="branchName" value="#{branchManagerBean.branchName}"/>
                            <p:message for="branchName" />
                            <h:outputLabel for="postalCode" style="font-weight: bold" value="Postal Code: * " />
                            <h:inputText autocomplete="off" required="true" maxlength="6" size="6" label="Postal Code" requiredMessage="Postal Code is required." id="postalCode" value="#{branchManagerBean.postalCode}"> 
                                <f:validateLength minimum="6" maximum="6" />
                            </h:inputText>
                            <p:message for="postalCode" />

                            <h:outputLabel for="houseNumber" style="font-weight: bold" value="Blk/House No: * " />
                            <h:inputText autocomplete="off" required="true" label="House Number" requiredMessage="Blk/House No is required." id="houseNumber" value="#{branchManagerBean.houseNumber}"/>
                            <p:message for="houseNumber" />

                            <h:outputLabel for="streetName" style="font-weight: bold" value="Street Name: * " />
                            <h:inputText required="true" requiredMessage="Street Name is required." label="Street Name" id="streetName" value="#{branchManagerBean.streetName}"/>
                            <p:message for="streetName" />

                            <h:outputLabel for="buildingName" style="font-weight: bold" value="Building Name: " />
                            <h:inputText label="Building Name" id="buildingName" value="#{branchManagerBean.buildingName}"/>
                            <p:message for="buildingName" />

                            <h:outputLabel for="contactNumber" style="font-weight: bold" value="Contact Number: * " />  
                            <p:inputMask required="true" requiredMessage="Contact Number is required." value="#{branchManagerBean.contactNumber}" id="contactNumber" mask="(999)-99999999"/>  
                            <p:message for="contactNumber" />

                            <h:outputLabel for="contactPerson" style="font-weight: bold" value="Contact Person: * " />
                            <h:inputText required="true" requiredMessage="Contact Person is required." label="Contact Person" id="contactPerson" value="#{branchManagerBean.contactPerson}"/>
                            <p:message for="contactPerson" />
                        </h:panelGrid>
                    </p:tab>

                    <p:tab title="Branch Specific Information">
                        <h:panelGrid  columns="3" cellpadding="10">
                            <h:outputLabel style="font-weight: bold" value="Cuisine Type: * " />
                            <h:selectManyCheckbox required="true" id="cuisineTypes" value="#{branchManagerBean.selectedCuisines}">
                                <f:selectItems value="#{branchManagerBean.cuisineTypeValues}"/>
                            </h:selectManyCheckbox>
                            <p:message for="cuisineTypes"/>

                            <h:outputLabel for="fnbType" style="font-weight: bold" value="FnB Type: * " />
                            <h:selectOneMenu required="true" id="fnbType" value="#{branchManagerBean.fnbType}" converter="fnbTypeConverter" >
                                <f:selectItems value="#{branchManagerBean.fnbTypes}" />
                            </h:selectOneMenu>
                            <p:message for="fnbType"/>
                            
                            <h:outputLabel for="isHalal" style="font-weight: bold" value="Halal Type: * " />
                            <h:selectOneRadio required="true" requiredMessage="Halal Type is required" id="isHalal" value="#{branchManagerBean.isHalal}">
                                <f:selectItem itemLabel="Yes" itemValue="Yes" />
                                <f:selectItem itemLabel="No" itemValue="No" />
                            </h:selectOneRadio>
                            <p:message for="isHalal"/>
                            
                            <h:outputLabel for="priceRange" style="font-weight: bold" value="Price Range: * " />
                            <h:selectOneMenu id="priceRange" required="true" value="#{branchManagerBean.priceRange}">
                                <f:selectItem itemLabel="SELECT" itemValue="Select" />
                                <f:selectItem itemLabel="Less Than $20" itemValue="Less Than $20" />
                                <f:selectItem itemLabel="$21 - $40" itemValue="$21 - $40" />                                
                                <f:selectItem itemLabel="$41 - $60" itemValue="$41 - $60" />
                                <f:selectItem itemLabel="$61 - $80" itemValue="$61 - $80" />
                                <f:selectItem itemLabel="$81 - $100" itemValue="$81 - $100" />
                                <f:selectItem itemLabel="More Than $100" itemValue="More Than $100" />
                            </h:selectOneMenu>
                            <p:message for="priceRange" />

                        </h:panelGrid>
                    </p:tab>
                    
                    <p:tab title="Branch Operating Hours">
                        <h:panelGrid columns="4" cellpadding="10">
                            <h:outputLabel for="mondayStart" style="font-weight: bold" value="Monday: " />
                            <h:selectOneMenu required="true" id="mondayStart" value="#{branchManagerBean.mondayStart}" converter="operatingHoursConverter">
                                <f:selectItems value="#{branchManagerBean.operatingHours}"/>
                            </h:selectOneMenu>
                            <p:message for="mondayStart" />
                        </h:panelGrid>
                    </p:tab>
                </p:tabView>

                <p:ajaxStatus style="width:16px;height:16px;">
                    <f:facet name="start">
                        <h:graphicImage value="http://www.primefaces.org:8080/showcase/design/ajaxloading.gif" />
                    </f:facet>
                    <f:facet name="complete">
                        <h:outputText value="" />
                    </f:facet>
                </p:ajaxStatus>
                <p:commandButton id="btn" value="#{branchManagerBean.button}" update="panel" ajax="true" actionListener="#{branchManagerBean.saveBranch}" />

            </p:panel>
        </h:form>
    </h:body>
</html>